<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>黑名单管理</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="../plugin/jquery-zoomify/zoomify.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/wangEditor-3.0.15/wangEditor.min.js"></script>
    <script src="../plugin/jquery-zoomify/zoomify.min.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../base/base.js'></script>

</head>

<body>

<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;
        var module = 'blacklist';
        var query = [];
        var toolbar = {
            default: [false, false, false, false],// back;add;edit;remove
            dialog: [60, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: [{
                name: '批量删除',
                glyphicon: 'list',
                onclick: 'batch_remove',
            }]
        };
        // 表单内容配置
        var bootstrapTable = {
            columns: [{
                checkbox: true
            },{
                field: 'email',
                title: '用户邮箱',
                align: 'center',
            },{
                field: 'overdueLevel',
                title: '逾期等级',
                align: 'center',
                formatter: function (value, row, index) {
                    if (value == 1) {
                        return 'A';
                    } else if (value == 2) {
                        return 'B';
                    } else if (value == 3) {
                        return 'C';
                    }
                },
            },{
                field: 'overdueAmount',
                title: '逾期次数',
                align: 'center',
            },{
                field: 'createReason',
                title: '加入原因',
                align: 'center',
                formatter: function (value, row, index) {
                    if (value == 1) {
                        return '逾期次数过多';
                    } else if (value == 2) {
                        return '逾期3天笔数>=1';
                    } else if (value == 3) {
                        return '逾期4天笔数>=2';
                    }
                },
            },{
                field: 'releaseDate',
                title: '解封时间',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.datetime
            }, {
                field: 'createDate',
                title: '加入时间',
                align: 'center',
                formatter: BootstrapTableUtil.formatter.datetime
            }
            ]
        };
        blacklist = SingleTablePageCreateUtil.createInstance(module, query, toolbar, null, bootstrapTable);
        //
        blacklist.batch_remove = function () {
            var ids = '';
            var rows = $("#blacklist_table").bootstrapTable('getSelections');
            if (rows.length == 0) {
                SwalUtil.error("您没有选中任何记录");
                return false;
            }
            SwalUtil.confirm(function () {
                for(var i=0; i<rows.length; i++){
                    ids += rows[i].blacklistId;
                    if(i != rows.length-1){
                        ids += ","
                    }
                }
                var resp = AjaxUtil.postJson('blacklist/batch_remove', {
                    ids:ids
                });
                if (resp) {
                    SwalUtil.success(resp.msg);
                    $('#blacklist_table').bootstrapTable('refresh');
                }
            })
        }
    });
</script>
</body>

</html>